/*
 * JGrafoSudoku.java
 *
 * Created on 3 de Junho de 2007, 12:56
 */

package dharsudoku.gui.testes;

import dharsudoku.core.grafo.GrafoSudoku;
import dharsudoku.core.vertice.VerticeCoord;

/**
 *
 * @author  rodrigo
 */
public class JGrafoSudoku extends javax.swing.JFrame {
    
    /** Creates new form JGrafoSudoku */
    public JGrafoSudoku() {
	initComponents();
	
	GrafoSudoku grafoSudoku = new GrafoSudoku();

	for (java.util.Iterator i = grafoSudoku.getVertices().iterator(); i.hasNext(); ){
	    VerticeCoord v = (VerticeCoord)i.next();
	    	 
	    int x = v.getX();
	    
	    v.setX(v.getX()*60 + (v.getY()*v.getY()));
	    v.setY(v.getY()*60 + (x*x));
	}
	
	((CanvasGrafo)canvasSudoku).setGrafo(grafoSudoku);
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        canvasSudoku = new CanvasGrafo();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Grafo SUdoku");
        setName("frameGrafoSudoku");
        setResizable(false);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(canvasSudoku, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 740, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(canvasSudoku, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 592, Short.MAX_VALUE)
                .addContainerGap())
        );
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-770)/2, (screenSize.height-641)/2, 770, 641);
    }// </editor-fold>//GEN-END:initComponents
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
	java.awt.EventQueue.invokeLater(new Runnable() {
	    public void run() {
		new JGrafoSudoku().setVisible(true);
	    }
	});
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private java.awt.Canvas canvasSudoku;
    // End of variables declaration//GEN-END:variables
    
}
